package com.ddstation.app.instrument_disinfect.controller;

import com.ddstation.common.entity.DdPictureEntity;
import com.ddstation.common.mapper.DdPictureMapper;
import com.ddstation.common.service.InvsItemInstitutionService;
import com.ddstation.common.util.AliCloudOssUtil;
import com.ddstation.common.util.CheckUtil;
import com.ddstation.common.util.GeneralCheckUtil;
import com.ddstation.crud.entity.DtInvsInstrumentDisinfectEntity;
import com.ddstation.instrument_disinfect.constant.UltravioletEnum;
import com.ddstation.instrument_disinfect.model.DtInvsInstitutionUltravioletInstrumentModel;
import com.ddstation.instrument_disinfect.model.DtInvsInstrumentDisinfectUltravioletModel;
import com.ddstation.instrument_disinfect.model.UltravioletRecordDisplayModel;
import com.ddstation.instrument_disinfect.service.InstrumentDisinfectService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.inject.Inject;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

@Controller
public class AppInstrumentDisinfectController {

    @Inject private InstrumentDisinfectService instrumentDisinfectService;
    @Inject private DdPictureMapper ddPictureMapper;
    @Inject private InvsItemInstitutionService invsItemInstitutionService;

    /**
     * (器械/场所消毒登记)获取历史记录
     * @param params
     * @return
     */
    @RequestMapping(value="appinvs_instrument_disinfect.do/history", method = RequestMethod.POST)
    public @ResponseBody
    Map<String, Object> invsInstrumentDisinfectHistoryEvent(
            @RequestBody Map<String, Object> params) {

        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("errCode", -1);
        if (params.isEmpty() || CheckUtil.isEmpty(params.get("institutionId"))
                || CheckUtil.isEmpty(params.get("instrumentType"))) {
            return retMap;
        }
        String institutionId = params.get("institutionId").toString();
        String pageSize = params.get("pageSize").toString();
        String pageNo = params.get("pageNo").toString();
        Integer instrumentType = Integer.parseInt(params.get("instrumentType").toString());

        retMap.put("itemList",instrumentDisinfectService.selectByHistory(institutionId,instrumentType,Integer.parseInt(pageNo),Integer.parseInt(pageSize)));
        retMap.put("errCode", 0);
        retMap.put("errorMsg", "");
        return retMap;

    }

    /**
     * (器械/场所消毒登记)获取器械/场所列表
     * @param params
     * @return
     */
    @RequestMapping(value="appinvs_instrument_disinfect.do/getDisinfectList", method = RequestMethod.POST)
    public @ResponseBody
    Map<String, Object> invsInstrumentDisinfectListEvent(
            @RequestBody Map<String, Object> params) {

        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("errCode", -1);
        if (params.isEmpty() || CheckUtil.isEmpty(params.get("institutionId"))
                || CheckUtil.isEmpty(params.get("instrumentType"))) {
            return retMap;
        }
        String institutionId = params.get("institutionId").toString();
        Integer instrumentType = Integer.parseInt(params.get("instrumentType").toString());

        retMap.put("itemList",instrumentDisinfectService.selectByInstrumentName(institutionId,instrumentType));
        retMap.put("errCode", 0);
        retMap.put("errorMsg", "");
        return retMap;
    }

    /**
     * (器械/场所消毒登记)增加器械/场所登记
     * @param params
     * @return
     */
    @RequestMapping(value="appinvs_instrument_disinfect.do/saveDisinfect", method = RequestMethod.POST)
    public @ResponseBody
    Map<String, Object> invsInstrumentDisinfectSaveEvent(
            @RequestBody Map<String, Object> params) {

        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("errCode", -1);
        if (params.isEmpty() || CheckUtil.isEmpty(params.get("institutionId"))
                || CheckUtil.isEmpty(params.get("doctorId"))
                || CheckUtil.isEmpty(params.get("currentDate"))
                || CheckUtil.isEmpty(params.get("instrumentType"))
                || CheckUtil.isEmpty(params.get("disinfectTypeCode"))
                || CheckUtil.isEmpty(params.get("itemList"))) {
            return retMap;
        }
        String institutionId = params.get("institutionId").toString();
        Integer doctorId = Integer.parseInt(params.get("doctorId").toString());
        String instrumentType = params.get("instrumentType").toString();
        String disinfectTypeCode = params.get("disinfectTypeCode").toString();
        String attachmentId = CheckUtil.isEmpty(params.get("attachmentId"))? null : params.get("attachmentId").toString();
        String currentTime1Str = CheckUtil.isEmpty(params.get("currentTime1"))? null : params.get("currentTime1").toString();
        String currentTime2Str = CheckUtil.isEmpty(params.get("currentTime2"))? null : params.get("currentTime2").toString();
        String currentDateStr = params.get("currentDate").toString();
        String itemList = params.get("itemList").toString();

        DtInvsInstrumentDisinfectEntity entity = new DtInvsInstrumentDisinfectEntity();
        entity.setCreateTm(new Date());
        entity.setInstitutionId(institutionId);
        entity.setDisinfectType(Short.valueOf(disinfectTypeCode));
        SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat f2 = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");
        Date currentDate = null;
        Calendar cal = Calendar.getInstance();
        try {
            currentDate = f.parse(currentDateStr);
            cal.setTime(currentDate);
            entity.setDisinfectDt(cal.getTime());
        } catch (ParseException e) {
            e.printStackTrace();
        }
        if ("1".equals(instrumentType)) {
            entity.setDisinfectStartTm(cal.getTime());
            entity.setDisinfectEndTm(cal.getTime());
        } else if ("2".equals(instrumentType)) {
            Date currentTime1 = null;
            Date currentTime2 = null;
            try {
                currentTime1 = f2.parse(currentDateStr + " " + currentTime1Str + ":00");
                cal.setTime(currentTime1);
                entity.setDisinfectStartTm(cal.getTime());
                currentTime2 = f2.parse(currentDateStr + " " + currentTime2Str + ":00");
                cal.setTime(currentTime2);
                entity.setDisinfectEndTm(cal.getTime());
            } catch (ParseException e) {
                e.printStackTrace();
            }
            if (!entity.getDisinfectStartTm().before(entity.getDisinfectEndTm())) {
                retMap.put("errCode", -1);
                retMap.put("errormsg", "开始时间与结束时间不正确");
                return retMap;
            }
        }
        entity.setInstrumentType(Short.valueOf(instrumentType));
        entity.setPaperImgId(attachmentId);
        entity.setDoctorId(doctorId);
        DtInvsInstrumentDisinfectUltravioletModel dtInvsInstrumentDisinfectUltravioletModel = null;
        if (null != params.get("ultraId")) {
            int duration = Integer.parseInt(params.get("ultraDuration").toString());
            if (duration < 0) {
                retMap.put("errCode", -1);
                retMap.put("errormsg", "使用时间不能为负数");
                return retMap;
            }
            dtInvsInstrumentDisinfectUltravioletModel = new DtInvsInstrumentDisinfectUltravioletModel();
            dtInvsInstrumentDisinfectUltravioletModel.setUltravioletId(Integer.parseInt(params.get("ultraId").toString()));
            dtInvsInstrumentDisinfectUltravioletModel.setDisinfectDuration(Integer.parseInt(params.get("ultraDuration").toString()));
        }
        retMap.putAll(instrumentDisinfectService.addInstrumentDisinfect(entity,itemList, dtInvsInstrumentDisinfectUltravioletModel));
        return retMap;
    }

    /**
     * (器械/场所消毒登记)获取消毒方法
     * @param params
     * @return
     */
    @RequestMapping(value="appinvs_instrument_disinfect.do/getMethod", method = RequestMethod.POST)
    public @ResponseBody
    Map<String, Object> getDisinfectMethodEvent(
            @RequestBody Map<String, Object> params) {

        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("errCode", -1);
        if (params.isEmpty() || CheckUtil.isEmpty(params.get("institutionId"))
                || CheckUtil.isEmpty(params.get("instrumentType"))) {
            return retMap;
        }

        String institutionId = CheckUtil.isEmpty(params.get("institutionId"))?null:params.get("institutionId").toString();
        Integer instrumentType = Integer.parseInt(CheckUtil.isEmpty(params.get("instrumentType"))?null:params.get("instrumentType").toString());
        Integer catalogId = 0;
        if (instrumentType == 1) {
            catalogId = 4;
        } else if (instrumentType == 2) {
            catalogId = 14;
        }

        //判断是否第一次
        if (invsItemInstitutionService.selectInvsItemAllCnt(catalogId,institutionId) == 0) {
            //首次从master获取原始数据
            invsItemInstitutionService.init(catalogId,institutionId);
        }
        retMap.put("list",invsItemInstitutionService.selectShowInvsItem(catalogId,institutionId));
        retMap.put("errCode", 0);
        retMap.put("errorMsg", "");
        return retMap;
    }

    /**
     * (器械/场所消毒登记)新增器械/场所
     * @param params
     * @return
     */
    @RequestMapping(value="appinvs_instrument_disinfect.do/addDisinfect", method = RequestMethod.POST)
    public @ResponseBody
    Map<String, Object> invsInstrumentAddDisinfectEvent(
            @RequestBody Map<String, Object> params) {

        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("errCode", -1);
        if (params.isEmpty() || CheckUtil.isEmpty(params.get("institutionId"))
                || CheckUtil.isEmpty(params.get("instrumentType"))
                || CheckUtil.isEmpty(params.get("name"))) {
            return retMap;
        }
        String institutionId = params.get("institutionId").toString();
        Integer instrumentType = Integer.parseInt(params.get("instrumentType").toString());
        String name = params.get("name").toString();
        List<String> list = instrumentDisinfectService.checkByInstrumentName(institutionId,instrumentType,name);
        if (list != null && list.size()>0) {
            retMap.put("errCode", -2);
            return retMap;
        }
        int cnt = instrumentDisinfectService.addInstrumentName(institutionId,instrumentType,name);
        if (cnt == 1)
            retMap.put("errCode", 0);
        retMap.put("errorMsg", "");
        return retMap;
    }

    /**
     * (器械/场所消毒登记)删除器械/场所
     * @param params
     * @return
     */
    @RequestMapping(value="appinvs_instrument_disinfect.do/delDisinfect", method = RequestMethod.POST)
    public @ResponseBody
    Map<String, Object> invsInstrumentDelDisinfectEvent(
            @RequestBody Map<String, Object> params) {

        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("errCode", -1);
        if (params.isEmpty() || CheckUtil.isEmpty(params.get("institutionId"))
                || CheckUtil.isEmpty(params.get("instrumentType"))
                || CheckUtil.isEmpty(params.get("id"))) {
            return retMap;
        }
        String institutionId = params.get("institutionId").toString();
        Integer instrumentType = Integer.parseInt(params.get("instrumentType").toString());
        Integer id = Integer.parseInt(params.get("id").toString());
        int cnt = instrumentDisinfectService.delInstrumentName(institutionId,instrumentType,id);
        if (cnt == 1)
            retMap.put("errCode", 0);
        retMap.put("errorMsg", "");
        return retMap;
    }

    /**
     * (器械/场所消毒登记)详细
     * @param params
     * @return
     */
    @RequestMapping(value="appinvs_instrument_disinfect.do/detail", method = RequestMethod.POST)
    public @ResponseBody
    Map<String, Object> invsInstrumentDetailEvent(
            @RequestBody Map<String, Object> params) {

        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("errCode", -1);
        if (params.isEmpty() || CheckUtil.isEmpty(params.get("institutionId"))
                || CheckUtil.isEmpty(params.get("id"))) {
            return retMap;
        }
        String institutionId = params.get("institutionId").toString();
        Integer id = Integer.parseInt(params.get("id").toString());
        DtInvsInstrumentDisinfectEntity infoEntity = instrumentDisinfectService.instrumentDisinfectDetail(institutionId,id);
        retMap.put("info", infoEntity);
        DtInvsInstrumentDisinfectUltravioletModel ultraModel = instrumentDisinfectService.getUltravioletUsageByDisinfectId(infoEntity.getId());
        if (null != ultraModel) {
            retMap.put("ultraRecord", ultraModel);
        }
        List<String> thumbImgList = new ArrayList<String>();
        List<String> originImgList = new ArrayList<String>();
        if (infoEntity != null && infoEntity.getPaperImgId() != null) {
            for (String m_id:infoEntity.getPaperImgId().split(",")) {
                if (!CheckUtil.isEmpty(m_id)) {
                    DdPictureEntity picture = ddPictureMapper.selectOne(m_id);
                    if (picture.getPath().endsWith("pdf") || picture.getPath().endsWith("PDF")
                            || picture.getPath().endsWith("xls") || picture.getPath().endsWith("xlsx")
                            || picture.getPath().endsWith("XLS") || picture.getPath().endsWith("XLSX")
                            || picture.getPath().endsWith("doc") || picture.getPath().endsWith("docx")
                            || picture.getPath().endsWith("DOC") || picture.getPath().endsWith("DOCX")) {
                        continue;
                    }
                    thumbImgList.add(AliCloudOssUtil.getThumbImgUrl(null, picture.getPath(), "@100h"));
                    originImgList.add(AliCloudOssUtil.getThumbImgUrl(null, picture.getPath(), "@800h"));
                }
            }
        }
        retMap.put("originImgList",originImgList);
        retMap.put("thumbImgList",thumbImgList);
        retMap.put("errCode", 0);
        retMap.put("errorMsg", "");
        return retMap;
    }

    /**
     * (器械/场所消毒登记)获取消毒方法
     * @param params
     * @return
     */
    @RequestMapping(value="appinvs_instrument_disinfect.do/getAllMethod", method = RequestMethod.POST)
    public @ResponseBody
    Map<String, Object> invsInstrumentDisinfectAllMethodEvent(
            @RequestBody Map<String, Object> params) {

        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("errCode", -1);
        if (params.isEmpty() || CheckUtil.isEmpty(params.get("institutionId"))
                || CheckUtil.isEmpty(params.get("instrumentType"))) {
            return retMap;
        }
        String institutionId = params.get("institutionId").toString();
        Integer instrumentType = Integer.parseInt(params.get("instrumentType").toString());
        Integer catalogId = 0;
        if (instrumentType == 1) {
            catalogId = 4;
        } else if (instrumentType == 2) {
            catalogId = 14;
        }
        retMap.put("itemList",invsItemInstitutionService.getInvsItemInstitutionList(catalogId,institutionId));
        retMap.put("errCode", 0);
        retMap.put("errorMsg", "");
        return retMap;
    }

    /**
     * (器械/场所消毒登记)获取显示的消毒方法
     * @param params
     * @return
     */
    @RequestMapping(value="appinvs_instrument_disinfect.do/getShowMethod", method = RequestMethod.POST)
    public @ResponseBody
    Map<String, Object> invsInstrumentDisinfectShowMethodEvent(
            @RequestBody Map<String, Object> params) {

        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("errCode", -1);
        if (params.isEmpty() || CheckUtil.isEmpty(params.get("institutionId"))
                || CheckUtil.isEmpty(params.get("instrumentType"))) {
            return retMap;
        }
        String institutionId = params.get("institutionId").toString();
        Integer instrumentType = Integer.parseInt(params.get("instrumentType").toString());
        Integer catalogId = 0;
        if (instrumentType == 1) {
            catalogId = 4;
        } else if (instrumentType == 2) {
            catalogId = 14;
        }
        retMap.put("itemList",invsItemInstitutionService.selectShowInvsItem(catalogId,institutionId));
        retMap.put("errCode", 0);
        retMap.put("errorMsg", "");
        return retMap;
    }

    /**
     * (器械/场所消毒登记)新增器械/场所消毒方法
     * @param params
     * @return
     */
    @RequestMapping(value="appinvs_instrument_disinfect.do/addMethod", method = RequestMethod.POST)
    public @ResponseBody
    Map<String, Object> invsInstrumentAddMethodEvent(
            @RequestBody Map<String, Object> params) {

        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("errCode", -1);
        if (params.isEmpty() || CheckUtil.isEmpty(params.get("institutionId"))
                || CheckUtil.isEmpty(params.get("instrumentType"))
                || CheckUtil.isEmpty(params.get("name"))) {
            return retMap;
        }
        String institutionId = params.get("institutionId").toString();
        Integer instrumentType = Integer.parseInt(params.get("instrumentType").toString());
        Integer catalogId = 0;
        if (instrumentType == 1) {
            catalogId = 4;
        } else if (instrumentType == 2) {
            catalogId = 14;
        }
        String name = params.get("name").toString();
        List<String> list = invsItemInstitutionService.checkByInvsItemName(catalogId,institutionId,name);
        if (list != null && list.size()>0) {
            retMap.put("errCode", -2);
            return retMap;
        }
        int cnt = invsItemInstitutionService.addInvsItem(catalogId,institutionId,name);
        if (cnt == 1)
            retMap.put("errCode", 0);
        retMap.put("errorMsg", "");
        return retMap;
    }

    /**
     * (器械/场所消毒登记)删除消毒方法
     * @param params
     * @return
     */
    @RequestMapping(value="appinvs_instrument_disinfect.do/delMethod", method = RequestMethod.POST)
    public @ResponseBody
    Map<String, Object> invsInstrumentDelMethodEvent(
            @RequestBody Map<String, Object> params) {

        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("errCode", -1);
        if (params.isEmpty() || CheckUtil.isEmpty(params.get("institutionId"))
                || CheckUtil.isEmpty(params.get("instrumentType"))
                || CheckUtil.isEmpty(params.get("id"))) {
            return retMap;
        }
        String institutionId = params.get("institutionId").toString();
        Integer instrumentType = Integer.parseInt(params.get("instrumentType").toString());
        Integer catalogId = 0;
        if (instrumentType == 1) {
            catalogId = 4;
        } else if (instrumentType == 2) {
            catalogId = 14;
        }
        Integer id = Integer.parseInt(params.get("id").toString());
        int cnt = invsItemInstitutionService.delInvsItem(catalogId,institutionId,id);
        if (cnt == 1)
            retMap.put("errCode", 0);
        retMap.put("errorMsg", "");
        return retMap;
    }

    /**
     * (器械/场所消毒登记)保存显示的消毒方法
     * @param params
     * @return
     */
    @RequestMapping(value="appinvs_instrument_disinfect.do/saveShowMethod", method = RequestMethod.POST)
    public @ResponseBody
    Map<String, Object> invsInstrumentSaveShowMethodEvent(
            @RequestBody Map<String, Object> params) {

        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("errCode", -1);
        if (params.isEmpty() || CheckUtil.isEmpty(params.get("institutionId"))
                || CheckUtil.isEmpty(params.get("instrumentType"))
                || CheckUtil.isEmpty(params.get("ids"))) {
            return retMap;
        }
        String institutionId = params.get("institutionId").toString();
        Integer instrumentType = Integer.parseInt(params.get("instrumentType").toString());
        Integer catalogId = 0;
        if (instrumentType == 1) {
            catalogId = 4;
        } else if (instrumentType == 2) {
            catalogId = 14;
        }
        String ids = params.get("ids").toString();
        invsItemInstitutionService.saveInvsItem(catalogId,institutionId,ids);
        retMap.put("errCode", 0);
        retMap.put("errorMsg", "");
        return retMap;
    }

    /**
     * 获取诊所所有紫外线灯的信息
     * @param params 参数Map
     * @return
     */
    @RequestMapping(value="appinvs_instrument_disinfect.do/ultraviolet/load", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> invsUltraInstrumentLoadEvent(@RequestBody Map<String, Object> params) {
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("errCode", -1);
        String institutionId = params.get("institutionId").toString();
        Integer status = null == params.get("status") ? null : Integer.parseInt(params.get("status").toString());
        List<DtInvsInstitutionUltravioletInstrumentModel> instruments = instrumentDisinfectService.getUltravioletInstrumentsByInstitution(institutionId, status);
        if (!GeneralCheckUtil.isEmptyList(instruments)) {
            retMap.put("instruments", instruments);
        }
        retMap.put("errCode", 0);
        return retMap;
    }

    @RequestMapping(value="appinvs_instrument_disinfect.do/ultraviolet/record/load", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> invsUltraUpdateRecordLoadEvent(@RequestBody Map<String, Object> params) {
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("errCode", -1);
        String institutionId = params.get("institutionId").toString();
        List<UltravioletRecordDisplayModel> records = instrumentDisinfectService.getUltravioletRecordsByInstitution(institutionId);
        if (!GeneralCheckUtil.isEmptyList(records)) {
            retMap.put("records", records);
        }
        retMap.put("errCode", 0);
        return retMap;
    }

    @RequestMapping(value="appinvs_instrument_disinfect.do/ultraviolet/save", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> saveUltraInstrumentEvent(@RequestBody Map<String, Object> params) {
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("errCode", -1);
        if (null == params || null == params.get("maxTime") || null == params.get("useTime")) {
            retMap.put("errorMsg", "参数为空，请输入参数。");
            return retMap;
        }
        DtInvsInstitutionUltravioletInstrumentModel model = new DtInvsInstitutionUltravioletInstrumentModel();
        model.setInstitutionId((String)params.get("institutionId"));
        model.setMaxTime((int)params.get("maxTime"));
        model.setUseTime((int)params.get("useTime"));
        model.setName((String)params.get("name"));
        if (model.getMaxTime() < model.getUseTime()) {
            model.setStatus(UltravioletEnum.OUTOFDATE.getValue());
        }
        if (instrumentDisinfectService.saveUltravioletInstrument(model)) {
            retMap.put("errCode", 0);
        }
        return retMap;
    }

    /**
     * 已更换灯芯，重新启用灯具
     * @param params 参数Map
     * @return
     */
    @RequestMapping(value="appinvs_instrument_disinfect.do/ultraviolet/refresh", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> refreshUltraInstrumentEvent(@RequestBody Map<String, Object> params) {
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("errCode", -1);
        Integer ultraId = Integer.parseInt(params.get("ultraId").toString());
        DtInvsInstitutionUltravioletInstrumentModel ultraModel = new DtInvsInstitutionUltravioletInstrumentModel();
        ultraModel.setId(ultraId);
        String institutionId = params.get("institutionId").toString();
        ultraModel.setInstitutionId(institutionId);
        if(null != params.get("maxTime")) {
            ultraModel.setMaxTime(Integer.parseInt(params.get("maxTime").toString()));
        }
        if(null != params.get("useTime")) {
            ultraModel.setUseTime(Integer.parseInt(params.get("useTime").toString()));
        } else {
            ultraModel.setUseTime(0);
        }
        ultraModel.setStatus(UltravioletEnum.NORMAL.getValue());
        if (instrumentDisinfectService.updateUltravioletInstrument(ultraModel)) {
            retMap.put("errCode", 0);
        }
        return retMap;
    }

    /**
     * 报废紫外线灯具
     * @param params 参数Map
     * @return
     */
    @RequestMapping(value="appinvs_instrument_disinfect.do/ultraviolet/abandon", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> abandonUltraInstrumentEvent(@RequestBody Map<String, Object> params) {
        Map<String, Object> retMap = new HashMap<String, Object>();
        retMap.put("errCode", -1);
        Integer ultraId = Integer.parseInt(params.get("ultraId").toString());
        if (instrumentDisinfectService.abandonUltravioletInstrument(ultraId)) {
            retMap.put("errCode", 0);
        }
        return retMap;
    }
}